import request from '@/utils/request'
import {SysMenuQuery, SysMenuParams} from "@/common/interface/menu.ts";

// 查询菜单权限列表
export function listMenu(query: SysMenuQuery) {
    return request({
        url: '/system/menu/list',
        method: 'get',
        params: query
    })
}

// 查询菜单权限树形列表
export function listTreeMenu(query: SysMenuQuery) {
    return request({
        url: '/system/menu/treeList',
        method: 'get',
        params: query
    })
}

// 查询菜单权限下拉树选择列表
export function treeSelect() {
    return request({
        url: '/system/menu/treeSelect',
        method: 'get'
    })
}

// 查询菜单权限详细
export function getMenu(id: number) {
    return request({
        url: '/system/menu/' + id,
        method: 'get'
    })
}

// 新增菜单权限
export function addMenu(data: SysMenuParams) {
    return request({
        url: '/system/menu',
        method: 'post',
        data: data
    })
}

// 修改菜单权限
export function updateMenu(data: SysMenuParams) {
    return request({
        url: '/system/menu',
        method: 'put',
        data: data
    })
}

// 删除菜单权限
export function delMenu(id: number) {
    return request({
        url: '/system/menu/' + id,
        method: 'delete'
    })
}
